package com.dorm.cj.dr.demo;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

public class P_CTest {
    public static void main(String[] args) throws IOException, InterruptedException {
        //创建消费者
        MyConsumer consumer1 = new MyConsumer("consumer1");
        MyConsumer consumer2 = new MyConsumer("consumer2");

        //创建disruptorQueue操作类对象
        DisruptorQueue disruptorQueue = DisruptorQueueFactory.getWorkPoolQueue(32, false, consumer1,consumer2);

        //创建一个生产者 模拟生产数据
        MyProducerThread producer1 = new MyProducerThread("producer1", disruptorQueue);

        //
        new Thread(producer1).start();

        //三秒之后停止生产
        TimeUnit.SECONDS.sleep(10);
        producer1.stopThread();
        System.in.read();
    }
}
